current version 1.9 -18th March 2025
version | date | comment |
---|---|---|
0.1 | 02/Nov/2007 | Original code |
0.2 | 30/Nov/2008 | extract grid of specified date |
0.3 | 10/Dec/2008 | export grid to netcdf dataset |
0.4 | 13/Dec/2008 | Add support to read ESRI GRID |
0.5 | 18/May/2009 | Add support to grid_mapping (makes use of GeoLib) |
0.6 | 03/Jul/2009 | export to file (ESRI GRID) |
0.7 | 07/Apr/2010 | added GetDtGrid |
0.8 | 19/May/2011 | increased decimal digits in header of exported esri grid |
0.9 | 17/Jun/2011 | add support to read netcdf file from WRF |
1.0 | 11/Mar/2012 | added GetFirstDate and GetTimeSteps |
1.1 | 17/Jun/2013 | added support for grid with non regularly spaced coordinates in netcdf dataset |
1.2 | 15/Dec/2016 | GetXYSizesFromFile modified to detect x and y coordinates by units |
1.3 | 18/Feb/2019 | GetXYSizesFromFile modified to detect coordinate convention lat-lon or lon-lat |
1.4 | 20/Apr/2021 | ScanTimeStringAsString to parse reference time in netcdf dataset |
1.5 | 11/Apr/2022 | SyncTime to return lower bounding time step of a given datetime |
1.6 | 06/Apr/2023 | comments reformatted to adhere FORD documenter standard |
1.7 | 08/Nov/2024 | increased number of decimal places of header in exported ESRI ASCII grid |
1.8 | 21/Jan/2025 | Easting and Northing used to find x and y coordinate |
1.9 | 18/Mar/2025 | minor bug fixing in reading coordinate reference system in netcdf files |
license: GNU GPL http://www.gnu.org/licenses/
This file is part of
MOSAICO -- MOdular library for raSter bAsed hydrologIcal appliCatiOn.
Copyright (C) 2011 Giovanni Ravazzani
set of fortran routines to manage input and output of grids.
The module supports different file formats:
NetCDF raster layer CF 1.0 compliant (Climate and Forecast metadata standard)
ESRI ASCII grid
ESRI BINARY grid
The module introduces two new variable types:
grid_real
to store floating point data, and
grid_integer
to store integer data.
Spatial conventions in netCDF file:
y
yDim ^ N
|
| W E
|
| S
1 |---------> x
1 xDim
index conventions: GRID(x,y)
Spatial conventions used in GridLib:
1 jdim
1 |---------> j
| N
|
| W E
|
| S
idim v
i
index conventions: GRID(i,j)
To initialize a new grid variable, either integer or float, you can:
read grid from NetCdf file passing the standard name:
TYPE(grid_real) :: new_grid
CALL NewGrid (new_grid, NetCdfFileName, stdName='air_temperature')
read grid from NetCdf file passing name of variable:
TYPE(grid_real) :: new_grid
CALL NewGrid (new_grid, NetCdfFileName, variable = 'T2m')
If NetCdf archive is multitemporal, that is contains more grids, one for each time, you can retrieve the grid for a given time:
TYPE(grid_real) :: new_grid
TYPE (DateTime) :: ncTime
ncTime = '2007-03-05T11:00:00+00:00'
CALL NewGrid (new_grid, NetCdfFileName, stdName='air_temperature', time = ncTime)
Read grid from ESRI ASCII file:
TYPE(grid_real) :: new_grid
fileName = 'file.asc'
CALL NewGrid (new_grid, fileName, ESRI_ASCII)
Read grid from ESRI BINARY file:
TYPE(grid_real) :: new_grid
fileName = 'file'
CALL NewGrid (new_grid, fileName, ESRI_BINARY)
Initialize grid using an existing one as template. The new grid is initialized with value 0:
TYPE(grid_real) :: template
TYPE(grid_integer) :: new_Grid
CALL NewGrid (newGrid, template)
If you want assign an initial value different than 0:
CALL NewGrid (new_Grid, template, 100)
The initial value must be of the same type as values stored in grid
To export a grid to a file you can:
write the grid to a netcdf file as variable termed VariableName:
TYPE(grid_real) :: grid
... some statements that assign data to grid
CALL ExportGrid (grid, NetCdfFileName, VariableName, 'add')
If the netcdf file is multitemporal, you can add grid to already existing ones in file:
TYPE(grid_real) :: grid
... some statements that assign data to grid
CALL ExportGrid (grid, NetCdfFileName, VariableName, 'append')
If NetCdfFileName does not exist, it is created.
Write the grid to ESRI ASCII or BINARY file:
TYPE(grid_real) :: grid
... some statements that assign data to grid
fileName = 'file.asc'
CALL ExportGrid (grid, fileName, ESRI_ASCII)
fileName = 'file'
CALL ExportGrid (grid, fileName, ESRI_BINARY)
If a grid is no more used you can free memory:
TYPE(grid_real) :: grid
... some statements that assign data to grid
CALL GridDestroy (grid)
References: NetCDF: http://www.unidata.ucar.edu/software/netcdf/ CF 1.0: http://cf-pcmdi.llnl.gov/ UDUNITS: http://www.unidata.ucar.edu/software/udunits/
Description: read a float grid from a ESRI ASCII file. Description: given filename of a multidimensional net-cdf file the GetDtGrid function returns the temporal resolution (seconds) assuming that it is regular If option checkRegular is true the function check that temporal resolution is regular
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=short), | public, | parameter | :: | ESRI_ASCII | = | 1 | |
integer(kind=short), | public, | parameter | :: | ESRI_BINARY | = | 2 | |
integer(kind=short), | public, | parameter | :: | NET_CDF | = | 3 | |
integer(kind=short), | private, | parameter | :: | MISSING_DEF_INT | = | -9999 | |
real(kind=float), | private, | parameter | :: | MISSING_DEF_REAL | = | -9999.9 |
export grid into netcdf file. Two actions are possible:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid |
grid to be exported |
||
character(len=*), | intent(in) | :: | file |
netcdf file to export to |
||
character(len=*), | intent(in) | :: | name |
name of variable in netcdf |
||
character(len=*), | intent(in) | :: | action |
add or append |
export grid into netcdf file. Two actions are possible:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid |
grid to be exported |
||
character(len=*), | intent(in) | :: | file |
netcdf file to export to |
||
character(len=*), | intent(in) | :: | name |
name of variable in netcdf |
||
character(len=*), | intent(in) | :: | action |
add or append |
export grid_real to file. List of supported format:
ESRI_ASCII
: ESRI ASCII GRIDESRI_BINARY
: ESRI BINARY GRIDType | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | layer | |||
character(len=*), | intent(in) | :: | fileName | |||
integer(kind=short), | intent(in) | :: | fileFormat |
export grid_integer to file. List of supported format:
ESRI_ASCII
: ESRI ASCII GRIDESRI_BINARY
: ESRI BINARY GRID Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | layer | |||
character(len=*), | intent(in) | :: | fileName | |||
integer(kind=short), | intent(in) | :: | fileFormat |
get grid mapping for a floating point grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(inout) | :: | layer |
get grid mapping for a floating point grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(inout) | :: | layer |
given ncId of a multidimensional net-cdf file the GetTimeStepsFromNCid function returns the number of time steps
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | ncId |
NetCdf Id for the file |
given filename of a multidimensional net-cdf file the GetTimeStepsFromFile function returns the number of time steps
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename |
deallocate float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(inout) | :: | layer |
deallocate integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(inout) | :: | layer |
read a grid from a file. List of supported format: ESRI_ASCII: ESRI ASCII GRID ESRI_BINARY: ESRI BINARY GRID NET_CDF: NetCDF CF compliant
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(out) | :: | layer |
gridreal to return |
||
character(len=*), | intent(in) | :: | fileName |
file to read |
||
integer(kind=short), | intent(in) | :: | fileFormat |
format of the file to read |
||
character(len=*), | intent(in), | optional | :: | variable |
variable to read |
|
character(len=*), | intent(in), | optional | :: | stdName |
standard name of the variable to read |
|
type(DateTime), | intent(in), | optional | :: | time |
time of the grid to read |
read a grid from a file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(out) | :: | layer |
grid to be returned |
||
character(len=*), | intent(in) | :: | fileName |
file to read |
||
integer(kind=short), | intent(in) | :: | fileFormat |
format of the file to read |
||
character(len=*), | intent(in), | optional | :: | variable |
variable to read |
|
character(len=*), | intent(in), | optional | :: | stdName |
standard name of the variable to read |
|
type(DateTime), | intent(in), | optional | :: | time |
time of the grid to read |
create a new grid_real using an existing grid_real as template
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(out) | :: | layer |
grid to be returned |
||
type(grid_real), | intent(in) | :: | grid | |||
real(kind=float), | intent(in), | optional | :: | initial |
create a new grid_real using an existing grid_integer as template
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(out) | :: | layer |
gridreal to return |
||
type(grid_integer), | intent(in) | :: | grid | |||
real(kind=float), | intent(in), | optional | :: | initial |
create a new grid_integer using an existing grid_integer as template
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(out) | :: | layer |
grid to be returned |
||
type(grid_integer), | intent(in) | :: | grid | |||
integer, | intent(in), | optional | :: | initial |
create a new grid_integer using an existing grid_real as template
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(out) | :: | layer |
grid to be returned |
||
type(grid_real), | intent(in) | :: | grid | |||
integer, | intent(in), | optional | :: | initial |
set the current time of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time | |||
type(grid_real), | intent(inout) | :: | layer |
set the current time of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time | |||
type(grid_integer), | intent(inout) | :: | layer |
set the esri pe string of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
type(grid_real), | intent(inout) | :: | layer |
set the esri pe string of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
type(grid_integer), | intent(inout) | :: | layer |
set the long name of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
type(grid_real), | intent(inout) | :: | layer |
set the long name of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
type(grid_integer), | intent(inout) | :: | layer |
set the reference time of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time | |||
type(grid_real), | intent(inout) | :: | layer |
set the reference time of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time | |||
type(grid_integer), | intent(inout) | :: | layer |
set the standard name of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
type(grid_real), | intent(inout) | :: | layer |
set the standard name of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
type(grid_integer), | intent(inout) | :: | layer |
set the units of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | units | |||
type(grid_real), | intent(inout) | :: | layer |
set the units of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | units | |||
type(grid_integer), | intent(inout) | :: | layer |
set the varying mode of a float grid Possible values:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | varMod | |||
type(grid_real), | intent(inout) | :: | layer |
set the varying mode of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | varMod | |||
type(grid_integer), | intent(inout) | :: | layer |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=short), | public, | ALLOCATABLE | :: | Iraster(:,:) |
used to transform not regular grid to regular raster |
||
integer(kind=short), | public, | ALLOCATABLE | :: | Jraster(:,:) |
used to transform not regular grid to regular raster georeferencing informations |
||
real(kind=float), | public | :: | cellsize | ||||
type(DateTime), | public | :: | current_time |
current date and time of the grid in memory |
|||
character(len=1000), | public | :: | esri_pe_string |
used by ArcMap 9.2 |
|||
character(len=300), | public | :: | file_name |
name of the file from which grid was read |
|||
type(CRS), | public | :: | grid_mapping |
Coordinate reference System |
|||
integer(kind=short), | public | :: | idim |
number of rows |
|||
integer(kind=short), | public | :: | jdim |
number of columns |
|||
character(len=300), | public | :: | long_name |
long descriptive name |
|||
integer(kind=long), | public, | ALLOCATABLE | :: | mat(:,:) |
data contained in grid |
||
type(DateTime), | public | :: | next_time |
time when next update is required |
|||
integer(kind=short), | public | :: | nodata |
scalar identifying missing value |
|||
type(DateTime), | public | :: | reference_time |
reference time from which calculate current |
|||
character(len=300), | public | :: | standard_name |
CF 1.0 compliant standard name |
|||
integer(kind=short), | public | :: | time_index |
position of grid in time dimension in netcdf file |
|||
character(len=7), | public | :: | time_unit |
define time unit. Accepted values are: seconds, second, sec, s minutes, minute, min hours, hour, hr, h days, day, d |
|||
character(len=30), | public | :: | units |
UDUNITS compliant measure units |
|||
integer(kind=long), | public | :: | valid_max |
maximum valid value |
|||
integer(kind=long), | public | :: | valid_min |
minimum valid value |
|||
character(len=300), | public | :: | var_name |
name of the variable |
|||
character(len=20), | public | :: | varying_mode |
mode to vary: steady, sequence, linear |
|||
real(kind=float), | public | :: | xllcorner | ||||
real(kind=float), | public | :: | yllcorner |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=short), | public, | ALLOCATABLE | :: | Iraster(:,:) |
used to transform not regular grid to regular raster |
||
integer(kind=short), | public, | ALLOCATABLE | :: | Jraster(:,:) |
used to transform not regular grid to regular raster georeferencing informations |
||
real(kind=float), | public | :: | cellsize | ||||
type(DateTime), | public | :: | current_time |
current date and time of the grid in memory |
|||
character(len=1000), | public | :: | esri_pe_string |
used by ArcMap 9.2 |
|||
character(len=300), | public | :: | file_name |
name of the file from which grid was read |
|||
type(CRS), | public | :: | grid_mapping |
Coordinate reference System |
|||
integer(kind=short), | public | :: | idim |
number of rows |
|||
integer(kind=short), | public | :: | jdim |
number of columns |
|||
character(len=300), | public | :: | long_name |
long descriptive name |
|||
real(kind=float), | public, | ALLOCATABLE | :: | mat(:,:) |
data variable contained in grid |
||
type(DateTime), | public | :: | next_time |
time when next update is required |
|||
real(kind=float), | public | :: | nodata |
scalar identifying missing value |
|||
type(DateTime), | public | :: | reference_time |
reference time from which calculate current |
|||
character(len=300), | public | :: | standard_name |
CF 1.0 compliant standard name |
|||
integer(kind=short), | public | :: | time_index |
position of grid in time dimension in netcdf file |
|||
character(len=7), | public | :: | time_unit |
define time unit. Accepted values are: seconds, second, sec, s minutes, minute, min hours, hour, hr, h days, day, d |
|||
character(len=30), | public | :: | units |
UDUNITS compliant measure units |
|||
real(kind=float), | public | :: | valid_max |
maximum valid value |
|||
real(kind=float), | public | :: | valid_min |
minimum valid value |
|||
character(len=300), | public | :: | var_name |
name of the variable |
|||
character(len=20), | public | :: | varying_mode |
mode to vary: sequence, linear |
|||
real(kind=float), | public | :: | xllcorner | ||||
real(kind=float), | public | :: | yllcorner |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename | |||
logical, | intent(in), | optional | :: | checkRegular |
given filename of a multidimensional net-cdf file the GetFirstDate function returns the date and time of first grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename |
get grid mapping for a floating point grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(inout) | :: | layer |
Description returns time given time index
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | ncId |
NetCdf Id for the file |
||
type(DateTime), | intent(in) | :: | refTime |
reference time to calculate time index |
||
character(len=*), | intent(in) | :: | timeUnit | |||
integer(kind=short), | intent(in) | :: | index |
time step |
returned time
given filename of a multidimensional net-cdf file the GetTimeStepsFromFile function returns the number of time steps
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename |
given ncId of a multidimensional net-cdf file the GetTimeStepsFromNCid function returns the number of time steps
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | ncId |
NetCdf Id for the file |
Description returns the time of the next grid in netcdf dataset
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | ncId |
NetCdf Id for the file |
||
type(DateTime), | intent(in) | :: | refTime |
reference time to calculate time index |
||
character(len=*), | intent(in) | :: | timeUnit | |||
integer(kind=short), | intent(in) | :: | current |
current time step |
returned time of the next grid
Calculate the index to extract the corresponding slice from netcdf file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | ncId |
NetCdf Id for the file |
||
type(DateTime), | intent(in) | :: | refTime |
reference time to calculate time index |
||
character(len=*) | :: | timeUnit | ||||
type(DateTime), | intent(in) | :: | time |
time to calculate index from reference time |
export grid into netcdf file. Two actions are possible:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | grid |
grid to be exported |
||
character(len=*), | intent(in) | :: | file |
netcdf file to export to |
||
character(len=*), | intent(in) | :: | name |
name of variable in netcdf |
||
character(len=*), | intent(in) | :: | action |
add or append |
Handle errors from netcdf related operation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | errcode |
export grid_real to a ESRI ASCII file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | layer | |||
character(len=*), | intent(in) | :: | fileName |
export grid_real to a ESRI BINARY file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | layer | |||
character(len=*), | intent(in) | :: | fileName |
export grid_real to file. List of supported format:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | layer | |||
character(len=*), | intent(in) | :: | fileName | |||
integer(kind=short), | intent(in) | :: | fileFormat |
export grid into netcdf file. Two actions are possible:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | grid |
grid to be exported |
||
character(len=*), | intent(in) | :: | file |
netcdf file to export to |
||
character(len=*), | intent(in) | :: | name |
name of variable in netcdf |
||
character(len=*), | intent(in) | :: | action |
add or append |
export grid_integer to a ESRI ASCII file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | layer | |||
character(len=*), | intent(in) | :: | fileName |
export grid_integer to a ESRI BINARY file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | layer | |||
character(len=*), | intent(in) | :: | fileName |
export grid_integer to file. List of supported format:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(in) | :: | layer | |||
character(len=*), | intent(in) | :: | fileName | |||
integer(kind=short), | intent(in) | :: | fileFormat |
read and calculate georeferencing informations from netCDF file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | ncId |
NetCdf Id for the file |
||
integer(kind=short), | intent(in) | :: | varId |
variable Id |
||
real(kind=float), | intent(out) | :: | cellsize |
cell resolution |
||
real(kind=float), | intent(out) | :: | xll |
x coordinate of lower left corner of map |
||
real(kind=float), | intent(out) | :: | yll |
y coordinate of lower left corner of map |
||
type(CRS), | intent(out) | :: | grid_mapping |
coordinate reference system |
||
integer(kind=short), | intent(inout) | :: | Iraster(:,:) | |||
integer(kind=short), | intent(inout) | :: | Jraster(:,:) | |||
logical, | intent(in) | :: | point2raster |
extraxt the number of columns (x) and rows (y) from netCDF file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | ncId |
NetCdf Id for the file |
||
integer(kind=short), | intent(out) | :: | x |
number of columns and rows |
||
integer(kind=short), | intent(out) | :: | y |
number of columns and rows |
||
integer(kind=short), | intent(out), | optional | :: | idx |
id of x variable |
|
integer(kind=short), | intent(out), | optional | :: | idy |
id of y variable |
|
character(len=*), | intent(out) | :: | shape |
ccordinate in vector or matrix |
||
integer(kind=short), | intent(out), | optional | :: | latlon |
coordinate order is lat-lon (1) or lon-lat (2) |
deallocate float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(inout) | :: | layer |
deallocate integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(inout) | :: | layer |
create a new grid_real using an existing grid_integer as template
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(out) | :: | layer |
gridreal to return |
||
type(grid_integer), | intent(in) | :: | grid | |||
real(kind=float), | intent(in), | optional | :: | initial |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fileName |
file to read |
||
type(grid_real), | intent(out) | :: | layer |
returned grid float |
read a float grid from a ESRI BINARY file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fileName |
file to read |
||
type(grid_real), | intent(out) | :: | layer |
returned grid float |
read a grid from a file. List of supported format: ESRI_ASCII: ESRI ASCII GRID ESRI_BINARY: ESRI BINARY GRID NET_CDF: NetCDF CF compliant
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(out) | :: | layer |
gridreal to return |
||
character(len=*), | intent(in) | :: | fileName |
file to read |
||
integer(kind=short), | intent(in) | :: | fileFormat |
format of the file to read |
||
character(len=*), | intent(in), | optional | :: | variable |
variable to read |
|
character(len=*), | intent(in), | optional | :: | stdName |
standard name of the variable to read |
|
type(DateTime), | intent(in), | optional | :: | time |
time of the grid to read |
create a new raster_real reading data from NetCDF file The variable to read can be defined by its current name or the standard_name. The dimensions x and y of the variable is calculated searching from the dimensions of the couple of variables with 'standard_name' equal to 'projection_x_coordinate' and 'projection_y_coordinate' for projected reference systems or 'longitude' and 'latitude' for geographic reference systems or 'grid_longitude' and 'grid_latitude' for rotated pole systems If a comprehensible reference systems is not found a geodetic reference system is supposed. Once the variable is retrieved, offset and scale factor are applied and a check on minimum and maximum valid value is performed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(out) | :: | layer |
gridreal to return |
||
character(len=*), | intent(in) | :: | fileName |
NetCDF file to be read |
||
character(len=*), | intent(in), | optional | :: | variable |
variable to read |
|
character(len=*), | intent(in), | optional | :: | stdName |
standard name of the variable to read |
|
type(DateTime), | intent(in), | optional | :: | time |
time of the grid to read |
create a new grid_integer using an existing grid_real as template
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(out) | :: | layer |
grid to be returned |
||
type(grid_real), | intent(in) | :: | grid | |||
integer, | intent(in), | optional | :: | initial |
create a new grid_integer using an existing grid_integer as template
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(out) | :: | layer |
grid to be returned |
||
type(grid_integer), | intent(in) | :: | grid | |||
integer, | intent(in), | optional | :: | initial |
read a integer grid from a ESRI ASCII file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fileName |
file to read |
||
type(grid_integer), | intent(out) | :: | layer |
returned grid float |
read a integer grid from a ESRI BINARY file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fileName |
file to read |
||
type(grid_integer), | intent(out) | :: | layer |
returned grid float |
read a grid from a file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(out) | :: | layer |
grid to be returned |
||
character(len=*), | intent(in) | :: | fileName |
file to read |
||
integer(kind=short), | intent(in) | :: | fileFormat |
format of the file to read |
||
character(len=*), | intent(in), | optional | :: | variable |
variable to read |
|
character(len=*), | intent(in), | optional | :: | stdName |
standard name of the variable to read |
|
type(DateTime), | intent(in), | optional | :: | time |
time of the grid to read |
create a new grid_integer reading data from NetCDF file The variable to read can be defined by its current name or the standard_name. The dimensions x and j of the variable is calculated searching from the dimensions of the couple of variables with 'standard_name' equal to 'projection_x_coordinate' and 'projection_y_coordinate' for projected reference systems or 'longitude' and 'latitude' for geographic reference systems or 'grid_longitude' and 'grid_latitude' for rotated pole systems If a comprehensible reference systems is not found a geodetic reference system is supposed. Once the variable is retrieved, offset and scale factor are applied and a check on minimum and maximum valid value is performed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_integer), | intent(out) | :: | layer |
gridreal to return |
||
character(len=*), | intent(in) | :: | fileName |
NetCDF file to read |
||
character(len=*), | intent(in), | optional | :: | variable |
variable to read |
|
character(len=*), | intent(in), | optional | :: | stdName |
standard name of the variable to read |
|
type(DateTime), | intent(in), | optional | :: | time |
time of the grid to read |
Parse units attribute of time variable Limits: string representing date and time must not contain blanks
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | ncId |
NetCdf Id for the file |
||
type(DateTime), | intent(out) | :: | ref_time | |||
character(len=7), | intent(out) | :: | time_unit |
scan a string to extract time information as character strings: year, month, day, hour, minute, second, timezone supported formats:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
character(len=*), | intent(out) | :: | YYYY |
year |
||
character(len=*), | intent(out) | :: | MM |
month |
||
character(len=*), | intent(out) | :: | DD |
day |
||
character(len=*), | intent(out) | :: | hh |
hour |
||
character(len=*), | intent(out) | :: | min |
minute |
||
character(len=*), | intent(out) | :: | ss |
second |
||
character(len=*), | intent(out) | :: | tz |
time zone |
set the current time of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time | |||
type(grid_integer), | intent(inout) | :: | layer |
set the esri pe string of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
type(grid_real), | intent(inout) | :: | layer |
set the esri pe string of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
type(grid_integer), | intent(inout) | :: | layer |
set the long name of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
type(grid_real), | intent(inout) | :: | layer |
set the long name of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
type(grid_integer), | intent(inout) | :: | layer |
set the reference time of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time | |||
type(grid_integer), | intent(inout) | :: | layer |
set the standard name of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
type(grid_real), | intent(inout) | :: | layer |
set the standard name of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
type(grid_integer), | intent(inout) | :: | layer |
set the units of a float grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | units | |||
type(grid_real), | intent(inout) | :: | layer |
set the units of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | units | |||
type(grid_integer), | intent(inout) | :: | layer |
set the varying mode of a float grid Possible values:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | varMod | |||
type(grid_real), | intent(inout) | :: | layer |
set the varying mode of a integer grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | varMod | |||
type(grid_integer), | intent(inout) | :: | layer |
transport matrix from grid_integer to netcdf format
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long), | intent(in) | :: | matIn(:,:) | |||
integer(kind=long), | intent(out) | :: | matOut(:,:) |
transport matrix from netcdf format to grid_integer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long), | intent(in) | :: | matIn(:,:) | |||
integer(kind=long), | intent(out) | :: | matOut(:,:) |
transport matrix from grid_real to netcdf format
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=float), | intent(in) | :: | matIn(:,:) | |||
real(kind=float), | intent(out) | :: | matOut(:,:) |
transport matrix from netcdf format to grid_real
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=float), | intent(in) | :: | matIn(:,:) | |||
real(kind=float), | intent(out) | :: | matOut(:,:) | |||
integer | :: | latlon |